package org.llc.bpmn.util;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.repository.Deployment;
import org.springframework.beans.factory.annotation.Autowired;

import java.io.InputStream;

/**
 * 流程模板部署
 */
public class Test2 {

    @Autowired
    ProcessEngine processEngine;

    public void deploymentProcessDefinition_inputStream() {
        InputStream inputStreambpmn=this.getClass().getResourceAsStream("/diagrams/ProcessVariobles.bpmn");
        InputStream inputStreampng=this.getClass().getResourceAsStream("/diagrams/ProcessVariobles.png");
        Deployment deployment = processEngine.getRepositoryService()// 与流程定义和部署对象相关的sevices
                .createDeployment()// 创建一个部署对象
                .name("流程定义")// 添加部署名称
                .addInputStream("ProcessVariobles.bpmn", inputStreambpmn)
                .addInputStream("ProcessVariobles.png", inputStreampng)
                .deploy();// 完成部署
        System.out.println("部署ID：" + deployment.getId());
        System.out.println("部署名称" + deployment.getName());
    }
}
